<template>
    <div>   
        <home-header></home-header>
        <home-icons :list="iconList"></home-icons>
        <home-swiper :list="swiperList"></home-swiper>
        <home-download></home-download>
        <home-discount :list="discountList"></home-discount>
        <home-findbrand :list="findbrandList"></home-findbrand>
        <home-tmdirectly :list="tmdirectlyList"></home-tmdirectly>
        <home-Choosegoods :list="choosegoodsList"></home-Choosegoods>
    </div>
</template>

<script>
import HomeHeader from "./components/Header"
import HomeIcons from "./components/Icons"
import HomeSwiper from "./components/Swiper"
import HomeDownload from "./components/Download"
import HomeDiscount from "./components/Discount"
import HomeFindbrand from "./components/Findbrand"
import HomeTmdirectly from "./components/Tmdirectly"
import HomeChoosegoods from "./components/Choosegoods"
import axios from "axios"
    export default{
        name:"Home",
        components:{
            HomeHeader,
            HomeIcons,
            HomeSwiper,
            HomeDownload,
            HomeDiscount,
            HomeFindbrand,
            HomeTmdirectly,
            HomeChoosegoods
        },
        data(){
            return{
                iconList:[],
                swiperList:[],
                discountList:[],
                findbrandList:[],
                tmdirectlyList:[],
                choosegoodsList:[],
                navList:[]
            }
        },
        methods:{
            getHomeInfo(){
                axios.get("/static/mock/icons.json")
                    .then(this.getHomeInfoSucc)
            },
            getHomeInfoSucc(res){
                // console.log(res)
                res = res.data
                if(res.ret && res.data){
                    this.iconList = res.data.icons
                    this.swiperList = res.data.swiper
                    this.discountList = res.data.discount
                    this.findbrandList = res.data.findbrand
                    this.tmdirectlyList = res.data.tmdirectly
                    this.choosegoodsList = res.data.choosegoods
                    this.navList = res.data.nav
                }
            }
        },
        mounted(){
            this.getHomeInfo()
        }
    }
</script>
